package net.mhelvens.deltaprofiles;

import android.util.SparseArray;

public class IterableSparseArray<T> extends SparseArray<T> implements java.lang.Iterable<T> {
	class Iterator implements java.util.Iterator<T> {
		
		IterableSparseArray<T> A;
		int i;
		
		private Iterator(IterableSparseArray<T> array) {
			A = array;
			i = -1;
		}
		
		@Override
		public boolean hasNext() {
			return A.size() > i + 1;
		}

		@Override
		public T next() {
			return A.get(++i);
		}

		@Override
		public void remove() {
			throw new UnsupportedOperationException();
		}
		
	}

	@Override
	public java.util.Iterator<T> iterator() {
		return new Iterator(this);
	}
}
